<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8"%>
<jsp:useBean id="pageBean" scope="request" class="com.agileai.hotweb.domain.PageBean"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>项目创建</title>
<%@include file="/jsp/inc/resource.inc.jsp"%>
<script type="text/javascript" src="aeditors/xheditor/xheditor-1.2.2.min.js"></script>
<script type="text/javascript" src="aeditors/xheditor/xheditor_lang/zh-cn.js"></script>
<script language="javascript">
function showUploadeList(obj){
	if($(obj).val()=="展开"){
		$(obj).val("收起");
		$("#emailConfigDiv").show();
	}else{
		$(obj).val("展开");
		$("#emailConfigDiv").hide();
	}
}
$(function(){
	postRequest('form1',{actionType:'buildProjectCode',showSplash:false,onComplete:function(responseText){
		$("#PI_CODE").val(responseText);
	}});
});
</script>
</head>
<body>

<form action="<%=pageBean.getHandlerURL()%>" name="form1" id="form1" method="post">
<%@include file="/jsp/inc/message.inc.jsp"%>
<% if(!"yes".equals(pageBean.inputValue("backHidden"))){%>
<div id="__ParamBar__" style="float: right;">&nbsp;</div>
<div id="__ToolBar__">

<table border="0" cellpadding="0" cellspacing="1">

<tr>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" align="center" onclick="enableSave()" ><input value="&nbsp;" type="button" class="editImgBtn" id="modifyImgBtn" title="编辑" />编辑</td>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" align="center" onclick="saveProject()"><input value="&nbsp;" type="button" class="saveImgBtn" id="saveImgBtn" title="保存" />保存</td>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" align="center" onclick="goToBack();"><input value="&nbsp;" type="button" class="backImgBtn" title="返回" />返回</td>
</tr>

</table>

</div>
<%}%>
<table class="detailTable" cellspacing="0" cellpadding="0">
<tr>
	<th width="100" nowrap>项目编码</th>
	<td><input id="PI_CODE" label="项目编码" name="PI_CODE" type="text" value="<%=pageBean.inputValue("PI_CODE")%>" size="24" class="text"  readonly="readonly"/>
</td>
</tr>
<tr>
	<th width="100" nowrap>项目名称</th>
	<td><input id="PI_NAME" label="项目名称" name="PI_NAME" type="text" value="<%=pageBean.inputValue("PI_NAME")%>" size="24" class="text" />
</td>
</tr>
<tr>
	<th width="100" nowrap>项目类型</th>   
	<td><select id="PI_TYPE" label="项目类型" name="PI_TYPE" class="select"><%=pageBean.inputValue("PI_TYPE")%></select>
</td>
</tr>
<tr>
	<th width="100" nowrap>创建时间</th>
	<td><input id="PI_CREATE_TIME" readonly="readonly" label="创建时间" name="PI_CREATE_TIME" type="text" value="<%=pageBean.inputTime("PI_CREATE_TIME")%>" size="24" class="text" />
</td>
</tr>
<tr>
	<th width="100" nowrap>创建人</th>
	<td><input id="PI_CREATE_PEOPLE_NAME" readonly="readonly"  label="创建人" name="PI_CREATE_PEOPLE_NAME" type="text" value="<%=pageBean.inputValue("PI_CREATE_PEOPLE_NAME")%>" size="24" class="text" />
		<input id="PI_CREATE_PEOPLE" readonly="readonly"  label="创建人" name="PI_CREATE_PEOPLE" type="hidden" value="<%=pageBean.inputValue("PI_CREATE_PEOPLE")%>"/>
</td>
</tr>
<tr>
	<th width="100" nowrap>项目地址</th>
	<td><input id="PI_PROJECT_ADDRES" label="项目地址" name="PI_PROJECT_ADDRES" type="text" value="<%=pageBean.inputValue("PI_PROJECT_ADDRES")%>" size="24" class="text" />
</td>
</tr>
<tr>
	<th width="100" nowrap>总人天</th>
	<td><input id="PI_SUM_DAY" label="总人天" name="PI_SUM_DAY" type="text" value="<%=pageBean.inputValue("PI_SUM_DAY")%>" size="24" class="text" />
</td>
</tr>
<tr>
	<th width="100" nowrap>项目经理</th>
	<td><input id="USER_NAME" label="项目经理" name="USER_NAME" type="text" readonly="readonly" value="<%=pageBean.inputValue("USER_NAME")%>" size="24" class="text" />
	<input  id="PI_MANAGER" label="项目经理" name="PI_MANAGER" type="hidden"  value="<%=pageBean.inputValue("PI_MANAGER")%>" size="24" class="text" />
	<img id="cviIdSelectImage" src="images/sta.gif" width="16" height="16" onclick="openManagerBox()" />
</td>
</tr>
<tr>
	<th width="100" nowrap>项目概述</th>
	<td><textarea id="PI_SUMMARY" label="项目概述" name="PI_SUMMARY" cols="40" rows="3" class="textarea"><%=pageBean.inputValue("PI_SUMMARY")%></textarea>
</td>
</tr>
<tr>
	<th width="100" nowrap>备注</th>
	<td><textarea id="PI_REMARKS" label="备注" name="PI_REMARKS" cols="40" rows="3" class="textarea"><%=pageBean.inputValue("PI_REMARKS")%></textarea>
</td>
</tr>
</table>
<% if("yes".equals(pageBean.inputValue("backHidden"))){%>
<input type="button" id="showUploade" class="button_4px" style="width:66px" value="展开" onclick="showUploadeList(this)"/>
<div id="emailConfigDiv" hidden>
<table border="0" cellpadding="0" cellspacing="1">
<tr>
<tr >
<td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" align="center" onclick="saveEmailConfig()"><input value="&nbsp;" type="button" class="saveImgBtn" id="saveImgBtn" title="保存" />保存邮箱配置
</td>
</tr>
</table>
<table  class="detailTable" cellspacing="0" cellpadding="0">
<tr>
	<th width="100" nowrap>邮箱服务器</th>
	<td><input  id="PI_MAIL_SEVER" label="邮箱服务器" name="PI_MAIL_SEVER" type="text"  value="<%=pageBean.inputValue("PI_MAIL_SEVER")%>" size="24" class="text" />
</td>
</tr>
<tr>
	<th width="100" nowrap>邮箱端口号</th>
	<td><input  id="PI_MAIL_POST" label="邮箱端口号" name="PI_MAIL_POST" type="text"  value="<%=pageBean.inputValue("PI_MAIL_POST")%>" size="24" class="text" />
</td>
<tr>
	<th width="100" nowrap>邮箱密码</th>
	<td><input  id="PI_MAIL_PWD" label="邮箱密码" name="PI_MAIL_PWD" type="password"  value="<%=pageBean.inputValue("PI_MAIL_PWD")%>" size="24" class="text" />
</td>
</tr>
<tr>
    <th width="100" nowrap>邮箱模板</th>
    <td><textarea style="width:100%;" id="EMAIL_TEMPLATE" name="EMAIL_TEMPLATE"  cols="45" rows="8" class="xheditor {skin:'o2007blue',tools:'mini'}"><%=pageBean.inputValue("EMAIL_TEMPLATE")%></textarea>
</td>
</tr>
</table>
</div>
<%} %>

<input type="hidden" name="actionType" id="actionType" value=""/>
<input type="hidden" name="operaType" id="operaType" value="<%=pageBean.getOperaType()%>"/>
<input type="hidden" id="PI_ID" name="PI_ID" value="<%=pageBean.inputValue("PI_ID")%>" />
<input type="hidden" id="roleId" name="roleId" value="<%=pageBean.inputValue("roleId")%>" />
</form>
<script language="javascript">
datetimeValidators[0].set("yyyy-MM-dd HH:mm").add("PI_CREATE_TIME");
intValidator.add("PI_SUM_DAY");
lengthValidators[0].set(60).add("PI_REMARKS");
initDetailOpertionImage();
requiredValidator.add("PI_NAME");
numValidator.add("PI_SUM_DAY");
requiredValidator.add("PI_SUM_DAY");
requiredValidator.add("PI_TYPE");
requiredValidator.add("USER_NAME");
intValidator.add("PI_MAIL_POST");
var managerBox;  
function openManagerBox(){
	var handlerId = "SelectProjectManager"; 
	if (!managerBox){
		managerBox = new PopupBox('managerBox','请选择项目经理',{size:'normal',width:'600px',top:'2px',scroll:'yes'});
	}
 var url = 'index?'+handlerId+'&PI_MANAGER='+'&targetId=PI_MANAGER&targetName=USER_NAME';
	managerBox.sendRequest(url);
}

function saveProject(){
	var projectName = $("#PI_NAME").val();
	var projectType = $("#PI_TYPE").val();
	var projectSumDay = $("#PI_SUM_DAY").val();
	var projectManager = $("#USER_NAME").val();
	var re = /^[0-9]+.?[0-9]*$/;
	if (validate()){
		postRequest('form1',{actionType:'save',showSplash:true,onComplete:function(responseText){
			hideSplash();
			if("update"==$("#operaType").val()){
				jAlert("修改成功!","信息提示",function(){
					parent.reloadTab();	
					goToBack();
				})
			}else{
				jAlert("创建成功!","信息提示",function(){
					parent.reloadTab();	
					goToBack();
				})
			}
	}});	
	}
}
 function saveEmailConfig(){
	 var emailSever = $("#PI_MAIL_SEVER").val();
	 var emailPost = $("#PI_MAIL_POST").val();
	 var emailPwd = $("#PI_MAIL_PWD").val();
	 if(emailSever == ''){
		jAlert("邮箱服务器不能为空"); 
		return;
	 }
     if(emailPost == ''){
    	jAlert("邮箱端口号不能为空"); 
    	return;
	 }
     if(emailPwd == ''){
    	jAlert("邮箱密码不能为空"); 
    	return;
     }
     
     postRequest('form1',{actionType:'saveEmailConfig',showSplash:true,onComplete:function(responseText){
    	hideSplash();
		jAlert('邮箱配置保存成功!');
	}});
}
</script>
</body>
</html>
<%@include file="/jsp/inc/scripts.inc.jsp"%>
